﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="ZX.Web.UI.Controls.Login" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>系统-登录</title>
    <link rel="icon" href="/Images/icon/favicon.ico" type="image/x-icon" />
    <link href="ExtendPage/Template/matrix-1/css/bootstrap.min.css" rel="stylesheet"
        type="text/css" />
    <%--<link href="ExtendPage/Template/matrix-1/css/matrix-login.css" rel="stylesheet" type="text/css" />--%>
    <link href="ExtendPage/Template/matrix-1/css/matrix-media.css" rel="stylesheet" type="text/css" />
    <link href="ExtendPage/Template/matrix-1/font-awesome/css/font-awesome.css" rel="stylesheet"
        type="text/css" />
    <script src="Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="/Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="/Scripts/yui_2.9.0/build/json/json-min.js"></script>
    <script type="text/javascript" src="/Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <style type="text/css">
        .main_input_box
        {
            text-align: right;
        }
        .ma > div
        {
            width: 104px;
            height: 128px;
            float: left;
            text-align: center;
            margin-right: 20px;
            padding: 3px;
            border: 1px solid #DDD;
        }
        .ma > div > img
        {
            width: 100px;
            height: 100px;
        }
    </style>
</head>
<body style="background-color: #fff; margin: 0px;">
    <div style="margin: 0 auto;">
        <div id="logo" style="width: 900px; margin: 0px auto;">
            <div id="dream" style="width: 420px; height: 60px; float: right; text-align: right;
                vertical-align: bottom; padding-top: 48px; font-weight: bold;">
                专注于企业正规化、持续化！帮助中国成为世界经济强国
            </div>
            <img src="/Images/logo.gif" alt="Logo" style="height: 60px; margin: 2px;" />
        </div>
    </div>
    <div style="margin: 0 auto; margin-top: 15px; background-color: #ddd; padding-top: 20px;
        background-image: url(/images/back.jpg);">
        <div id="loginbox" style="width: 900px; height: 450px; margin: 0px auto;">
            <form id="form1" runat="server">
            <div style="width: 400px; background-color: #fff; margin-left: 450px; padding: 20px;">
                <div class="control-group normal_text">
  <h3></h3>
                </div>
                <div class="control-group">
                    <div class="controls">
                        <div class="main_input_box">
                            <span class="add-on bg_lg"><i class="icon-user">用户:</i></span>
                            <input id="txtUserName" type="text" value="" runat="server" placeholder="Username" />
                        </div>
                    </div>
                </div>
                <div class="control-group">
                    <div class="controls">
                        <div class="main_input_box">
                            <span class="add-on bg_ly"><i class="icon-lock">密码:</i></span>
                            <input id="txtPassword" type="password" value="" runat="server" placeholder="Password" />
                        </div>
                    </div>
                </div>
                <div class="control-group" id="Lcode" style="display: <%=validateCode %>">
                    <div class="controls">
                        <div class="main_input_box">
                            <span class="add-on bg_ly"><i class="icon-code"></i></span>
                            <input id="txtCode" type="text" runat="server" />
                            <img id="vimg" src="VCode.aspx" style="vertical-align: bottom; cursor: pointer; width: 50px;
                                height: 25px;" onclick="javascript:document.getElementById('vimg').src='VCode.aspx?'+new Date();"
                                alt="看不清，换一张" title="看不清，换一张" runat="server" />
                        </div>
                    </div>
                </div>
                <div class="control-group">
                    <div class="controls">
                        <div class="main_input_box">
                            <span id="btnLogin" onclick="javascript:Login();" style="width: 400px;" class="btn btn-danger">
                                立 即 登 录</span>
                        </div>
                    </div>
                </div>
                <div id="source" style="visibility: hidden;">
                    企业号：
                    <select id="txtSource" name="dept" style="width: 134px;" runat="server">
                    </select>
                </div>
                <asp:ImageButton ID="LbtnLogin" CssClass="LbtnLogin" runat="server" ImageUrl="Images/png/btn_dl.gif"
                    OnClientClick="return Login()" Style="display: none" />
                <asp:ImageButton ID="LbtnReset" CssClass="LbtnReset" runat="server" ImageUrl="Images/png/btn_qx.gif"
                    OnClick="btnReset_Click" Style="display: none" />
            </div>
            <div style="width: 400px; background-color: #eee; margin-left: 450px; padding: 20px;
                height: 150px;" class="ma">
                <div class="1st">
                    <img src="Images/app/an.png" />
                   \
                </div>
                <div class="lst">扫扫微信二维码关注</div>
                <div>
                    <img src="Images/app/ap.png" />
                    实效管理
                </div>
            </div>
            </form>
        </div>
    </div>
    <div style="margin: 0 auto;">
        <div id="Div1" style="width: 900px; margin: 0px auto; text-align: center; padding-top: 10px;">
            为了正常使用公司系统，建议使用google,IE8-IE10浏览器<br />
           AKD(C)版权所有
        </div>
    </div>
    <script type="text/javascript">
        function Validation(type) {
            var temp = true;
            var name = document.getElementById("txtUserName").value;
            var pwd = document.getElementById("txtPassword").value;
            var code = document.getElementById("txtCode").value;
            if (name == "") {
                alert("用户名不能为空!");
                $("#txtUserName").focus();
                temp = false;
            } else if (pwd == "") {
                alert("密码不能为空!");
                $("#txtPassword").focus();
                temp = false;
            }
            return temp;
        }


        function Login() {

            if (!Validation()) {
                return false;
            }

            var formObject = document.getElementById('form1');
            YAHOO.util.Connect.setForm(formObject);
            var cObj = YAHOO.util.Connect.asyncRequest('POST', "newlogin.aspx?action=login&r=" + Math.random(), callback);
            return false;
        }
        var responseSuccess = function (res) {
            //alert(res.responseText);   
            //debugger
            try {

                var str = res.responseText;

                if (str == "2") {
                    location.href = "MainMatix.aspx";
                    return;
                }
                if (str == "1") {
                    alert("用户己经过期，不能使用！");
                    $("#txtUserName").focus();
                    return;
                }
                if (str == "0") {
                    alert("用户名或密码错误，请重新输入！");
                    $("#txtPassword").focus();
                    return;
                }
                if (str == "3") {
                    alert("验证码错误，请重新输入！");
                    $("#txtCode").focus();
                    return;
                }
            }
            catch (e) {
                alert(e);
            }
            finally {
            }
        };
        var responseFailure = function (error) {
            alert("登陆失败!");
        }

        var callback = {
            success: responseSuccess,
            failure: responseFailure
        };

        $(document).ready(function () {
            $('input').bind('keyup', function (event) {
                if (event.keyCode == "13") {
                    if ($(this).attr("id") == "txtUserName") {
                        $("#txtPassword").focus();
                    }
                    if ($(this).attr("id") == "txtPassword") {
                        $("#txtCode").focus();
                    }
                    if ($(this).attr("id") == "txtCode") {
                        Login();
                    }
                }
            });
        });

    </script>
</body>
</html>
